home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Technotools
/
Technotools (Chestnut CD-ROM)(1993).ISO
/
lang_c
/
cug106
/
util1.c
< prev
next >
Wrap
C/C++ Source or Header
|
1984-06-14
|
1KB
|
58 lines
/*
Function Summary
----------------
charcnt(bufpntr)
returns the number of characters in the file at bufpntr.
file must be in a continuous block of RAM.
linecnt(bufpntr)
returns the number of lines in the file at bufpntr.
file must be in a continuous block of RAM.
ntoi(number,base)
converts ASCII digits to an integer using any base
except split octal (see otoi). white space may preceed
the ASCII string which must end with '\0' after the
final digit.
otoi(number)
converts ASCII digits representing a split octal
number in the format xxx.xxx{a} to an integer. white
space may preceed the ASCII string which must be
7 characters long (3 chars,'.',3 chars). any following
characters are ignored (ie. does not require '\0' as
final delimiter).
wordcnt(bufpntr)
returns the number of words in the file at bufpntr.
file must be in a continuous block of RAM. note that
'\n' is handled explicitly as CRLF to avoid false
triggering of the word count on an empty line.
*/
#define LF 10
#define CR 13
#define EOF 26
#define NO 0
#define YES -1
charcnt(bufpntr)
char *bufpntr;
{
int nc;
char c;
nc = 0;
while((c = *bufpntr++) != EOF) nc += 1;
return nc;
}
linecnt(bufpntr)
char *bufpntr;
{